Function problem solution in hacker rank

visit shbcf.ru